package com.harmontronics.hanma.paas.paas.domain.organization.repository.mapper;

import com.harmontronics.hanma.paas.paas.domain.organization.entity.OrgTree;
import com.harmontronics.hanma.paas.paas.domain.organization.repository.po.HmOrgPO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 组织架构
 * 
 * @author paas-generator
 * @email paas-generator@harmontronics.com
 * @date 2021-04-01 14:45:15
 */
@Mapper
public interface HmOrgMapper extends BaseMapper<HmOrgPO> {

    @Select("select Max(serial_num) from hm_org where parent_id=#{parentId} and deleted = 0")
    Long selectMaxSerialNum(@Param("parentId") Long parentId);

    OrgTree selectOrgTreeWithOrgId(Long orgId);

    List<HmOrgPO> selectOrgWithUserId(Long userId);
}
